﻿
using Shake.Framework.Models;
namespace Shake.Framework.Context
{
    public class PostResult
    {
        public object Data { get; set; }

        public PaginationContent Pagination { get; set; }

        public string Message { get; set; }

        public bool IsOk { get; set; }

        public PostResult(bool isOk = true)
        {
            this.IsOk = isOk;
        }
        
        public PostResult(string message, bool isOk = false)
        {
            this.Message = message;
            this.IsOk = isOk;
        }

        public PostResult(string message, object data, bool isOk = false)
        {
            this.Message = message;
            this.Data = data;
            this.IsOk = isOk;
        }

        public T GetData<T>() where T : class
        {
            if (Data == null) return null;
            return Data as T;
        }
    }
}
